#include<bits/stdc++.h>
using namespace std;
namespace my_std{
	#define ll long long
	#define bl bool
	ll my_pow(ll a,ll b,ll mod){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res=(res*a)%mod;
			a=(a*a)%mod;
			b>>=1;
		}
		return res;
	}
	ll qpow(ll a,ll b){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res*=a;
			a*=a;
			b>>=1;
		}
		return res;
	}
	#define db long double
	#define pf printf
	#define pc putchar
	#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
	#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
	#define go(u) for(ll i=head[u];i;i=e[i].nxt)
	#define enter pc('\n')
	#define space pc(' ')
	#define fir first
	#define sec second
	#define MP make_pair
	#define il inline
	#define inf 8e18
	#define random(x) rand()*rand()%(x)
	#define inv(a,mod) my_pow((a),(mod-2),(mod))
	il ll read(){
		ll sum=0,f=1;
		char ch=0;
		while(!isdigit(ch)){
			if(ch=='-') f=-1;
			ch=getchar();
		}
		while(isdigit(ch)){
			sum=sum*10+(ch^48);
			ch=getchar();
		}
		return sum*f;
	}
	il void write(ll x){
		if(x<0){
			x=-x;
			pc('-');
		}
		if(x>9) write(x/10);
		pc(x%10+'0');
	}
	il void writeln(ll x){
		write(x);
		enter;
	}
	il void writesp(ll x){
		write(x);
		space;
	}
}
using namespace my_std;
ll n,h[1000010],r[1000010],R[1000010];
db f[1000010],ans=0;
il db calc(ll x,ll y){
	db k1=2.0*h[x]/(R[x]-r[x]),k2=2.0*h[y]/(R[y]-r[y]);
	if(r[y]>=R[x]) return h[x];
	if(k1<=k2){
		if(r[y]<=r[x]) return 0;
		else return 0.5*(r[y]-r[x])*k1;
	}
	if(R[y]>=R[x]){
		db X=1.0*h[x]/k1+0.5*r[x],A=1.0*h[x]-k2*(X-0.5*r[y]);
		if(A<=0) return 0;
		else return A;
	}
	db A=0.5*(R[y]-r[x])*k1-1.0*h[y];
	if(A<=0) return 0;
	else return A;
}
int main(){
	freopen("wan.in","r",stdin);
	freopen("wan.out","w",stdout);
	n=read();
	fr(i,1,n){
		h[i]=read();
		r[i]=read();
		R[i]=read();
	}
	fr(i,2,n) fr(j,1,i-1) f[i]=max(f[i],f[j]+calc(j,i));
	fr(i,1,n) ans=max(ans,f[i]+h[i]);
	pf("%.11Lf",ans);
}
